package elementalgit;

import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import javax.sound.sampled.UnsupportedAudioFileException;

import javax.swing.Timer;


public class SplashScreen extends javax.swing.JFrame {

    public SplashScreen() {
        initComponents();
    }

    //@SuppressWarnings("unchecked")
        private void initComponents() {

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setUndecorated(true);
        setLocation(130,100);
        
        splashscreenimage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/elementalgit/SplashScreenImage.jpg"))); // NOI18N
        splashscreenimage.setMinimumSize(new java.awt.Dimension(1500, 600));
               
        
        
        //splashscreenimage.setMinimumSize(new java.awt.Dimension(1500, 600));
        
        /*splashscreenimage.addMouseListener(new java.awt.event.MouseAdapter() {
            @Override
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                splashscreenimageMouseClicked(evt);
            }
        });*/

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(splashscreenimage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE));
        layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                .addComponent(splashscreenimage, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE)));
                
        
        
        pack();
    }
    
    /*
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        splashscreenimage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/elementalgit/SplashScreenImage.jpg"))); // NOI18N
        splashscreenimage.setAlignmentX(3.0F);
        splashscreenimage.setMinimumSize(new java.awt.Dimension(1500, 600));
        splashscreenimage.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                splashscreenimageMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(106, 106, 106)
                .addComponent(splashscreenimage, javax.swing.GroupLayout.PREFERRED_SIZE, 815, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(splashscreenimage, javax.swing.GroupLayout.PREFERRED_SIZE, 465, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    */
/*
    private void splashscreenimageMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_splashscreenimageMouseClicked
       MenuScreen newone = new MenuScreen();
       //newone.setVisible(true);
       MenuScreen.open();
       this.setVisible(false);
    }//GEN-LAST:event_splashscreenimageMouseClicked
*/
    public static void open() throws UnsupportedAudioFileException, IOException {

        java.awt.EventQueue.invokeLater(new Runnable() {
            
            public void run() {
               
        
               
               
            }
        });
        final SplashScreen screen1 = new SplashScreen();
        screen1.setLocationRelativeTo(null);
        screen1.setVisible(true);
        
        
        int delay = 8000;
        ActionListener taskPerformer = new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                screen1.setVisible(false);
                MenuScreen newone = new MenuScreen();
                
                newone.open();               
                
                
            }
        };
        //random comment so i can commit
        ActionListener taskPerformer2 = new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                splashscreenimage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/elementalgit/dewey inc.jpg"))); // NOI18N
            }
        };
        Timer timer = new Timer(delay, taskPerformer);
        timer.setRepeats(false);
        timer.start();
        Timer timer2 = new Timer(4000, taskPerformer2);
        timer2.setRepeats(false);
        timer2.start();
    }
    
//new comment so I can commit
    // Variables declaration - do not modify//GEN-BEGIN:variables
    public static final javax.swing.JLabel splashscreenimage = new javax.swing.JLabel();
    // End of variables declaration//GEN-END:variables
   
}



